package com.example.demodb.repository;

import com.example.demodb.entity.CarbonArticleContent;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;

import java.util.List;
import java.util.Optional;

public interface ICarbonArticleContentRepository extends JpaRepository<CarbonArticleContent, Integer> {

//    Optional<CarbonArticleContent> findById(Integer id);

//    @Query(value = "SELECT c FROM CarbonArticleContent c ORDER BY c.id LIMIT 10", nativeQuery = true)

    //找最早的15条
    List<CarbonArticleContent> findTop15ByOrderById();

    //找最新的15条
    List<CarbonArticleContent> findTop15ByOrderByIdDesc();
//
//    SysAccount findByPhone(String phone);
}
